package com.wing.order.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 签收记录
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ord_order_delivery_sign")
public class OrderDeliverySign extends BaseEntity<OrderDeliverySign> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 已签收
        */
        signed(0,"已签收"),
        /**
        * 已入库
        */
        inventoryIn(1,"已入库"),
        /**
         * 部分入库
         */
        inventoryPart(2,"部分入库");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 签收记录编号
     */
    private String code;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 配送单id
     */
    private Long deliveryId;

    /**
     * 配送单明细id
     */
    private Long deliveryDetailId;

    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;


    /**
     * 物流单号
     */
    private String expressCode;

    /**
     *发货人
     */
    private String delivererName;

    /**
     * 联系人
     */
    private String contactName;

    /**
     * 联系电话
     */
    private String phone;
    /**
     * 出入库计划id
     */
    private Long planId;

    public enum SignType implements IEnum<Integer> {

        /**
         * 配送签收
         */
        delivery(0,"配送签收"),
        /**
         * 入库签收
         */
        storage(1,"入库签收"),

        purchase(2,"采购入库");

        private int code;
        private String desc;

        SignType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 签收类型
     */
    private SignType signType;

    /**
     * 签收类型描述
     */
    @TableField(exist = false)
    private String signTypeDesc;

    public String getSignTypeDesc() {
        return signType == null ? null : signType.getDesc();
    }

}
